<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Dv_company_name extends CI_Controller {

	     public function __construct()
       {
            parent::__construct();
		$this->load->helper("html");
		$this->load->helper("url");
		$this->load->helper('form');
		$this->load->helper('date');
		$this->load->model("dv_company_name_model");
		//$this->load->model("guest_comment_model");
		//$this->load->model("news_events_model");
		//$this->load->model("roomcottages_model");
		$this->load->helper(array('form', 'url'));
		$this->load->database();
		
	}
	
	//START ------------------dv---------------------
	function index()
	{
		$data['title']="Administrator Page";
		$data["list_dv_company_names"] = $this->dv_company_name_model->get_all_dv_company_name();	
		$this->load->view('dv_company_name_list_view',$data);
	}

	function view_dv_company_name()
	{
		$data['title']="Administrator Page";
		$code = $this->uri->segment(3);
		$data["list_dv_company_names"] = $this->dv_company_name_model->getdv_company_name_info($code);
		//$data["list_customers"] = $this->customers_model->getcustomers();
		$this->load->view('dv_company_name_list_view',$data);
		
	}
	
	function add_dv_company_name()
	{
		//$data["driver_dv_data"] = $this->dv_model->add_view_driver_dv();
		$this->load->view('dv_company_name_add_view');
	}
	function p_add_dv_company_name()
	{
		
		$this->load->database();			
		$dv_company_name =$_POST['txtdv_company_name'];
		$_sql="insert into dvcompanyname(dv_company_name)";
		$_sql.="values('$dv_company_name')";
		$query = $this->db->query($_sql); 
	/*	$dv_id=$this->db->insert_id();
	 
		$_sql="insert into dv_contract(dv_id,contract_amount)";
		$_sql.="values($dv_id,$contract_amt)";
		$query = $this->db->query($_sql); */
			
		$data["list_dv_company_names"] = $this->dv_company_name_model->get_all_dv_company_name();	
		$this->load->view('dv_company_name_list_view',$data);
							
	}

	function edit_dv_company_name()
	{
 	    $code = $this->uri->segment(3);
		$data["info"] = $this->dv_company_name_model->getdv_company_name_info($code);	
		$this->load->view('dv_company_name_edit_view',$data);
	}
	
	function p_edit_dv_company_name()
	{
		$this->load->database();
		    $dv_co_n_id= $_POST['hid_co_n_id'];
			$dv_company_name = $_POST['txtdv_company_name'];
			$query = $this->db->query("UPDATE dv_company_name SET 
												  		  
														  dv_company_name='$dv_company_name' ");
														  
		$data["list_dv_company_names"] = $this->dv_company_name_model->get_all_dv_company_name();	
		$this->load->view('dv_company_name_list_view',$data);		
	}
	
	
	function delete_dv_company_name()
	{
		$this->load->database();		
		$code = $this->uri->segment(3);
		$query = $this->db->query("delete from profile where profile_id='$code'");
		
		$data["list_dv_company_names"] = $this->dv_company_name_model->get_all_dv_company_name();	
		$this->load->view('dv_company_name_list_view',$data);
	}
	//END ------------------dv---------------------
	
	
	function logout()
	{
		
		//$this->load->library('session');
		//$this->session->sess_destroy();
		session_start();
		session_destroy();
		//echo $_SESSION['Administrator_log'];
		//unset($_SESSION['Administrator_log']);
		
			//$data["newsresult"] = $this->dv_model->dv_all_driver_dv();
			$this->load->view('admin_view');
	 
	}
 
}
?>